package com.eastfair.builder.enumeration;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展位状态
 * </p>
 *
 * @author dq
 * @date 2022-08-06
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitorStatusEnum", description = "展位状态 #{UNREPORT:未报馆;REPORTING:报馆中;REPORTED:已报馆;UNAPPROACH:未进场;BUILDING:搭建中;BUILDED:已搭建;SHOW:展览中;DEPOSITING:撤展中;DEPOSIT:已撤展;}")
public enum ExhibitorStatusEnum implements BaseEnum {


    UNREPORT("未报馆"),

    REPORTING("报馆中"),

    REPORTED("已报馆"),

    UNAPPROACH("未进场"),

    BUILDING("搭建中"),

    BUILDED("已搭建"),

    SHOW("展览中"),

    DEPOSITING("撤展中"),

    DEPOSIT("已撤展"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitorStatusEnum match(String val, ExhibitorStatusEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitorStatusEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitorStatusEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "UNREPORT,REPORTING,REPORTED,;UNAPPROACH,BUILDING,BUILDED,SHOW,DEPOSITING,DEPOSIT}", example = "UNREPORT")
    public String getCode() {
        return this.name();
    }

}
